package main

import (
	"fmt"
	"math/rand"
)

func main() {
	//guessDate()
	goToMars()
}

func guessDate() {
	for times := 0; times < 10; times++ {
		var year int

		for {
			fakeYear := rand.Intn(2050) + 1
			if fakeYear >= 1900 {
				year = fakeYear
				break
			}
		}

		month := rand.Intn(12) + 1
		dayInOneMonth := 31

		if year%4 == 0 {
			switch month {
			case 2:
				dayInOneMonth = 29
			case 4, 6, 9, 11:
				dayInOneMonth = 30
			}
		} else {
			switch month {
			case 2:
				dayInOneMonth = 28
			case 4, 6, 9, 11:
				dayInOneMonth = 30
			}
		}

		day := rand.Intn(dayInOneMonth) + 1
		fmt.Println(year, "-", month, "-", day)
	}
}

func goToMars() {
	for time := 0; time < 10; time++ {
		//获取公司
		var SpaceLine string
		SpaceLineNumber := rand.Intn(3) + 1
		switch SpaceLineNumber {
		case 1:
			SpaceLine = "Space Adventures"
		case 2:
			SpaceLine = "SpaceX"
		case 3:
			SpaceLine = "Virgin"
		}
		//获取时间
		var distance = 62100000
		var speed = rand.Intn(15) + 16
		var time = (distance / speed) / 60 / 60 / 24
		//获取单程还是往返
		var backWay string
		var backWayNumber = rand.Intn(2)
		var Price int = rand.Intn(1401) + 3600
		if backWayNumber == 0 {
			backWay = "Round--trip"
			Price = Price * 2
		} else {
			backWay = "One--way"
		}

		fmt.Printf("航空公司为：%v,旅行时间：%vday,往返方式：%v,价格：%v\n万元", SpaceLine, time, backWay, Price)
	}
}
